package com.wlc.base.method;

/**
 * @author 王立朝 wanglichao@champion-credit.com
 * @description 方法
 * @date 2021-06-23 12:47
 */
public class Demo01 {

    public void method1(double num1,int ... numbs) {
        System.out.println("num1");
        for (int i = 0; i < numbs.length; i++) {
            System.out.println("第"+i+"个数字是"+numbs[i]);
        }
    }

    /**
     * 比较最大值，并把最大值返回
     * @param doubles
     * @return
     */
    public double method2(double ... doubles){
        if (doubles.length ==0){
            System.out.println("没有数据");
            return 0.0;
        }
        double result = 0.0;
        for (double d:doubles){
            if(d>result){
                result =d;
            }
        }
        return result;
    }

    public static void main(String[] args) {
        Demo01 demo01 = new Demo01();
        System.out.println("最大的数字是： = " + demo01.method2(2.0, 3, 3, 3, 45, 6, 7, 8));
    }
}
